<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <include file="Public:jquery" />
        <include file="Public:dialog" />
        <include file="Public:startapp" />
        <include file="Public:startmoo" />
        <script type="text/javascript">
            $(function(){
                $('#add_role').click(function(){
					var $add_action = art.dialog({
						title : $(this).text(),
						lock : true
					});
					
					$.ajax({
						url : "__URL__/add",
						success : function(data){
							$add_action.content(data);
							submitstyle();
						},
						cache : false
					});
					
					return false;
				});
				
				$('.role_action').click(function(){
					art.dialog.open($(this).attr('href'),{
						title : $(this).text(),
						lock : true,
						width : 700,
						height : 400
					});
					return false;
				});
				
				$('.role_user_list').click(function(){
					var $role_action = art.dialog({
						title : $(this).text(),
						width : 750,
						lock : true
					});
					$.ajax({
						url : $(this).attr('href'),
						success : function(data){
							$role_action.content(data);
							$('#select_all_user').click(function(){
								$('input[name="groupUserId[]"]').attr('checked','checked');
							});
							$('#cancel').click(function(){
								$('input[name="groupUserId[]"]').removeAttr('checked');
							});
							submitstyle();
						},
						cache : false
					});
					return false;
				});
				
				$('.edit_role').click(function(){
					var edit_role_url = $(this).attr('href');
					var edit_role = art.dialog({
						lock : true
					});
					$.ajax({
						url : edit_role_url,
						success : function(data){
							edit_role.content(data);
							submitstyle();
						},
						cache : false
					});
					return false;
				});
				
				$('.del_role').click(function(){
					var del_url = $(this).attr('href');
					$.ajax({
						url : "__URL__/checkDelete/id/" + $(this).attr('rel'),
						dataType : "json",
						success : function(data){
							if (data.status == 0){
								art.dialog({
									content : data.info,
									lock : true
								});
							}else{
								art.dialog({
									content : '确定删除吗？',
									ok : function(){
										window.location.href = del_url;
									},
									cancel : true,
									lock : true
								});
							}
						},
						cache : false
					});
					return false;
				});
            });
        </script>
        
    </head>
    <body>
        <include file="Public:header" />
        
        <div class="layout">
            
            <include file="Public:position" />
            
            <table class="warp" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="sidebar" valign="top">
                        <include file="Public:sidebar" />
                    </td>
                    <td class="contents" valign="top">
                        
                        <div class="button">
                            <a href="javascript:void(0);" class="default_button" id="add_role"><span></span>新增角色</a>
                        </div>
                        
                        <div class="a_table">
                        <table cellspacing="1" width="100%" class="gr_list">
							<tr style="background: #f0f7ff; font-weight: bold;">
								<td width="60" align="center" height="20">编号</td>
								<td align="center">组名</td>
								<td width="120" align="center">上级组</td>
								<td width="150" align="center">状态</td>
								<td align="center">描述</td>
								<td width="200" align="center">操作</td>
							</tr>
							{$list}
						</table>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        <include file="Public:footer" />
    </body>
</html>